<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // while循环和do...while循环的区别
        // while循环是先判断再执行
        // do...while循环是先执行再判断

        
        // 求10的阶乘
        let numResult = 10;
        let result = 1;
        while(numResult > 0){
            result *= numResult
            numResult--
        }
        console.log(result);

        // do while案例
        let answer;
        do {
           answer = window.prompt("1+1=?")
        } while (answer != 2);
        
        console.log("回答正确");
    </script>
</body>
</html>